import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/guild_income_detail_entity.dart';

GuildIncomeDetailEntity $GuildIncomeDetailEntityFromJson(
    Map<String, dynamic> json) {
  final GuildIncomeDetailEntity guildIncomeDetailEntity = GuildIncomeDetailEntity();
  final String? totalInput = jsonConvert.convert<String>(json['totalInput']);
  if (totalInput != null) {
    guildIncomeDetailEntity.totalInput = totalInput;
  }
  final List<GuildIncomeDetailList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<GuildIncomeDetailList>(e) as GuildIncomeDetailList)
      .toList();
  if (list != null) {
    guildIncomeDetailEntity.list = list;
  }
  return guildIncomeDetailEntity;
}

Map<String, dynamic> $GuildIncomeDetailEntityToJson(
    GuildIncomeDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['totalInput'] = entity.totalInput;
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  return data;
}

extension GuildIncomeDetailEntityExt on GuildIncomeDetailEntity {
  GuildIncomeDetailEntity copyWith({
    String? totalInput,
    List<GuildIncomeDetailList>? list,
  }) {
    return GuildIncomeDetailEntity()
      ..totalInput = totalInput ?? this.totalInput
      ..list = list ?? this.list;
  }
}

GuildIncomeDetailList $GuildIncomeDetailListFromJson(
    Map<String, dynamic> json) {
  final GuildIncomeDetailList guildIncomeDetailList = GuildIncomeDetailList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    guildIncomeDetailList.id = id;
  }
  final String? income = jsonConvert.convert<String>(json['income']);
  if (income != null) {
    guildIncomeDetailList.income = income;
  }
  final int? cycle = jsonConvert.convert<int>(json['cycle']);
  if (cycle != null) {
    guildIncomeDetailList.cycle = cycle;
  }
  final String? ratio = jsonConvert.convert<String>(json['ratio']);
  if (ratio != null) {
    guildIncomeDetailList.ratio = ratio;
  }
  return guildIncomeDetailList;
}

Map<String, dynamic> $GuildIncomeDetailListToJson(
    GuildIncomeDetailList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['income'] = entity.income;
  data['cycle'] = entity.cycle;
  data['ratio'] = entity.ratio;
  return data;
}

extension GuildIncomeDetailListExt on GuildIncomeDetailList {
  GuildIncomeDetailList copyWith({
    String? id,
    String? income,
    int? cycle,
    String? ratio,
  }) {
    return GuildIncomeDetailList()
      ..id = id ?? this.id
      ..income = income ?? this.income
      ..cycle = cycle ?? this.cycle
      ..ratio = ratio ?? this.ratio;
  }
}